package com.qiuzhao.handler;

import com.qiuzhao.entity.vo.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public CommonResult exceptionHandler(Exception ex) {
        log.error("异常信息：{}", ex.getMessage());
        return CommonResult.error(ex.getMessage());
    }
}
